package designPattern.action11.ChainOfResponsibility.c9t2_me;
/*
这个me包下的改进有：
1.支持链式写法
2.CommonHandler实现了Handler，使得原来Handler子类无需重复写一样的setNextHandler方法
 */


public class Application {
    private Handler beijing, shanghai, tianjin;    //责任链上的对象

    public static void main(String args[]) {
        Application application = new Application();
        application.createChain();
        application.reponseClient("77720810340930632");
    }

    public void createChain() {       //建立责任链
        beijing = new Beijing();
        shanghai = new Shanghai();
        tianjin = new Tianjin();
        beijing.setNextHandler(shanghai).setNextHandler(tianjin);
    }

    public void reponseClient(String number) {  //响应用户的请求
        beijing.handleRequest(number);
    }
}

